<?php
namespace Home\Controller;
use Think\Controller;

class Lnyc2019Controller extends Controller {
    public function index(){
        indexRvent();//测算首页执行事件
        cookie('orderidnum','Lnyc2019');

        indexRequest($_REQUEST);//测算首页接收数据处理

        $channel=cookie('channel');

        if($channel!='vivo'){
            redirect(U('Lnyc2020/index','',false));exit;
        }

        if($channel=='qudao241'||$channel=='qudao146'){
            redirect(U('Bzjp/index','',false));exit;
        }

        $this->assign('channel',$channel);
        discountprice($channel,'YJ');//优惠价格获取

        $this->assign('titleName',titleName('Lnyc2019',1));//首页名称


        if($_REQUEST['csType']){//分享赚佣金
            cookie('csType',$_REQUEST['csType']);
            cookie('shareUid',$_REQUEST['shareUid']);//别人分享的链接
            if(cookie('shareUid')==''){
                $ShareController=A('Share');
                $collectionType=$ShareController->selectCollection();//是否收藏
                $priceArr=$ShareController->shareZhuan('lnyc2019');//获取首页数据价格
                cookie('pricezhuan',$priceArr['price']);
                //dump($priceArr);exit;
                $this->assign('priceArr',$priceArr);
                $this->assign('collectionType',$collectionType);
                $this->assign('discount',$_REQUEST['discount']);
                $this->assign('csTypeNum',1);
                $this->assign('csType','lnyc2019');
            }
        }

        if($_REQUEST['discount']){//是否是优惠
            cookie('discount',1);
            if($_REQUEST['discount']>=2){//取消优惠
                cookie('discount',0);
            }
        }

        if($channel=='qudao135'&&cookie('discount135')==''){//针对渠道 是否支付过优惠价格
            discountSelect(34);
        }
        if(cookie('discount135')==1){
            cookie('discount',null);//取消优惠
        }

        $this->assign('discount',cookie('discount'));//是否优惠价格

        $user_agent = $_SERVER['HTTP_USER_AGENT'];//用户使用的浏览器，操作系统等信息。
        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            cookie('wxlogin',0);
        }else{
            cookie('wxlogin',1);

            getToken();
            getTicket();
            $noncestr=noncestr(15);
            $timestamp=time();
            $ticket= S('ticket');
            $wzurl=wxJsdkData();

            $signature=sha1("jsapi_ticket={$ticket}&noncestr={$noncestr}&timestamp={$timestamp}&url={$wzurl}");

            $this->assign('appid',cookie('APPID'));
            $this->assign('timestamp',$timestamp);
            $this->assign('noncestr',$noncestr);
            $this->assign('signature',$signature);


            if(!empty($_REQUEST['code'])){
                cookie('code',$_REQUEST['code'],7100);
            }
            getCode($wzurl);
            getOopenid();

            wxShareUrl('YJ','Lnyc2019');//分享地址获取
            cookie('uid',cookie('openid'));
        }

        //渠道获取统计ID   其他公共调用
        $channelID=obtain_channelID('YJ');
        $this->assign('channelID',$channelID);

        if(cookie('jploginHC')==''||cookie('lnyc2019cs')==''){
            cnzz_pvuv('YJ');//执行统计
            cookie('jploginHC',1,30);
            //2019流年运程随机数
            csRandNum('lnyc2019cs',300000,499999);
        }

        if(channelVivo($channel)){
            $this->display("Lnyc2019/ZM_2019ys_index_vivo");
        }else{
            $this->display("Lnyc2019/ZM_2019ys_index");
        }

    }
    public function zhifu(){
        //渠道获取统计ID
        $channelID=obtain_channelID('YJ-Z');
        $this->assign('channelID',$channelID);

        $discount=cookie('discount');
        $reducePrice=cookie('reducePrice');
        if($discount||$reducePrice){//是否使用了优惠价格
            $this->assign('discount',1);
        }else{
            $this->assign('discount',0);
        }

        $this->assign('titleName',titleName('Lnyc2019',2));//首页名称
        $strData=mb_substr(cookie('orderid'),0,2);
        if($strData=='QS')cookie('orderid',null);

        cookie('timeStrto',time()+7200);//倒计时时间戳
        $user_agent = $_SERVER['HTTP_USER_AGENT'];//用户使用的浏览器，操作系统等信息。
        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            cookie('wxlogin',0);
            $this->assign('wxlogin',0);
        }else{
            cookie('wxlogin',1);
            $this->assign('wxlogin',1);

            $noncestr=noncestr(15);
            $timestamp=time();
            $ticket= S('ticket');
            $wzurl=wxJsdkData();
            $signature=sha1("jsapi_ticket={$ticket}&noncestr={$noncestr}&timestamp={$timestamp}&url={$wzurl}");

            $this->assign('appid',cookie('APPID'));
            $this->assign('timestamp',$timestamp);
            $this->assign('noncestr',$noncestr);
            $this->assign('signature',$signature);
        }

        if($_REQUEST['username']){//返回操作
            cookie('znickname',I('post.username'),604800);
            cookie('zymd',mb_substr($_REQUEST['birthday'],2,10));
            cookie('zhour',mb_substr($_REQUEST['birthday'],13,2));
            cookie('zsex',$_REQUEST['gender'],604800);
            cookie('datetype',mb_substr($_REQUEST['birthday'],0,1));
        }


        if(!empty($_REQUEST['ordernum'])){//未支付订单
            $arrdata[0]=S('sm_h5test|'.$_REQUEST['ordernum']);
            $zymd=$arrdata[0]['year'].'-'.str_pad($arrdata[0]['month'],2,"0",STR_PAD_LEFT).'-'.str_pad($arrdata[0]['day'],2,'0',STR_PAD_LEFT);
            cookie('zymd',$zymd,604800);
            cookie('zhour',$arrdata[0]['hour'],604800);
            cookie('znickname',$arrdata[0]['username'],604800);
            cookie('zsex',$arrdata[0]['sex'],604800);
            cookie('datetype',$arrdata[0]['datetype']);

            cookie('orderid',$_REQUEST['ordernum'],604800);
        }

        $y=mb_substr(cookie('zymd'),0,4);//年
        $m=mb_substr(cookie('zymd'),5,2); //月
        $d=mb_substr(cookie('zymd'),8,2);//日
        $zyinli=yinli($y,$m,$d);
        cookie('zyangli',$y.'年'.$m.'月'.$d.'日'.' '.cookie('zhour').'时',604800);//阳历
        cookie('zyinli',$zyinli[0].'年'.$zyinli[1].$zyinli[2],604800);//阴历

        $data=cookie('orderid');//获取订单号
        if(empty($data)&&empty($_REQUEST['ordernum'])){
            $orderid='YJ'.date('Ymd').mt_rand(1000,9999).date('His');
            cookie('orderid',$orderid,604800);
        }

        //创建订单
        $hour=cookie('zhour');if($hour=='')$hour=0;
        $shop=cookie('orderid');
        $znickname=cookie('znickname');if($znickname=='')$znickname='匿名';
        $zsex=cookie('zsex');if($zsex=='')$zsex=1;
        $channel=cookie('channel');
        $imei=cookie('uid');
        $y=mb_substr(cookie('zymd'),0,4);//年
        $m=mb_substr(cookie('zymd'),5,2); //月
        $d=mb_substr(cookie('zymd'),8,2);//日
        $datetype=cookie('datetype');if($datetype=='')$datetype=0;
        defaultPrice();

        channelPay($channel,'YJ');//查询渠道价格

        csPay($znickname,$channel);//测试价格判断
        $price=cookie('price');

        $discountprice=cookie('discountprice');//优惠价格

        if(cookie('discount135')==1){//不是使用优惠价格
            $this->assign('channelDiscount',0);//隐藏返回优惠弹框
        }else{
            if($price>$discountprice){
                if($discount||$reducePrice){//优惠价格
                    $price-=$discountprice;cookie('price',$price);
                }
            }

            if(channelDiscount()){//优惠渠道判断  显示还是隐藏
                $this->assign('channelDiscount',1);
            }else{
                $this->assign('channelDiscount',0);
            }
        }

        if(cookie('couponPrice')){//是否有使用优惠券
            cookie('price',cookie('couponPrice'));
            $this->assign('discount',10);//优惠券价格
        }else{
            $this->assign('discount',0);//优惠券价格
        }

        if(cookie('discountQczh')){//是否有趣测优惠券
            $price=cookie('price');
            cookie('price',$price/2);
            $remark='discountQczh';
            dump(cookie('price'));
        }


        //别人分享的uid
        if(cookie('shareUid')){$remark='Share'.cookie('shareUid');}

        $price=cookie('price');
        if(empty($_REQUEST['ordernum'])){
//            $arrdata=M()->query("select * from sm_h5test where ordernum='{$shop}'");
//            if(empty($arrdata)){
//                M()->query("insert into sm_h5test (ordernum,price,username,typeid,sex,status,datetype,year,month,day,hour,paykind,date_remark,appuserid,ip,channel,remark)values(
//                                              '{$shop}','{$price}','{$znickname}',34,{$zsex},-1,{$datetype},{$y},{$m},{$d},{$hour},-1,'{$remark}','{$imei}','{$_SERVER['REMOTE_ADDR']}','{$channel}','{$discount}')");
//                $IndexController=A('Index');
//                $IndexController->subNumber('YJ');
//            }
//            if(!cookie($_REQUEST['username'])){//返回操作
//                //更新订单
//                M()->query("update sm_h5test set username='{$znickname}',datetype='{$datetype}',year={$y},month={$m},day={$d},hour={$hour},sex={$zsex} where ordernum='{$shop}'");
//            }
            $arrdata=S('sm_h5test|'.$shop);
            if(empty($arrdata)){
                $smH5testinter=array(
                    'ordernum'=>$shop, 'price'=>$price, 'username'=>$znickname, 'typeid'=>34, 'sex'=>$zsex, 'createtime'=>date('Y-m-d H:i:m'),
                    'status'=>-1, 'datetype'=>$datetype, 'year'=>$y, 'month'=>$m, 'day'=>$d, 'hour'=>$hour, 'date_remark'=>$remark,
                    'appuserid'=>$imei, 'ip'=>$_SERVER['REMOTE_ADDR'], 'channel'=>$channel, 'auto_send_sms'=>0, 'place'=>0,'remark'=>$discount
                );
                S('sm_h5test|'.$shop,$smH5testinter,2592000);//2592000为30天
                cacheZhiFuOrderid($shop);//支付页缓存订单操作

                $IndexController=A('Index');//Index控制器
                $IndexController->subNumber('YJ');//提交订单次数统计
            }else if(!cookie($_REQUEST['username'])){//返回操作
                //更新订单
                $arrdata['username']=$znickname;$arrdata['datetype']=$datetype;
                $arrdata['year']=$y;$arrdata['month']=$m;$arrdata['day']=$d;$arrdata['sex']=$zsex;
                S('sm_h5test|'.$shop,$arrdata,2592000);//2592000为30天
            }
        }

        if(cookie('zsex')==1){$zsex='男';}else{$zsex='女';}
        zwmp(cookie('zymd'), cookie('zhour'),$zsex,'sizhu');
        $sizhu=I('globals.sizhu');
        $this->assign('sizhu',$sizhu);//Z四柱
        $bztaisui=bztaisui($sizhu);//犯太岁
        $this->assign('bztaisui',$bztaisui);

        if(changeJieguoPay($channel)){//判断渠道显示结果
            $zhanxing=new \Library\ZhanXing();
            $constellation=$zhanxing->constellation($m,$d);//获取星座
            $lnyuncheng2019=lnyuncheng2019($zymd,I('globals.dayun'),I('globals.dayunss'),$constellation,$hour);
            $this->assign('lnyuncheng2019',$lnyuncheng2019);//2019流年运程
        }


        if($datetype==1){
            $this->assign('datetype',"农历 ".cookie('zyinli')." ".mb_substr($sizhu[3],1,1,'utf-8')."时");
        }else{
            $this->assign('datetype',"阳历 ".cookie('zyangli'));
        }

        $dianping=DYdianping($y+$m+$d);//大运点评
        $this->assign('dianping',$dianping);

        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            if (strpos($user_agent, 'Windows') == true||strpos($user_agent,'Mac') == true) {
                //Windows 电脑访问
                if(channelSaoma($channel)){
                    $this->assign('pc',1);
                    $saomaUrl=wxsaoma('YJ','2019流年运程',cookie('orderid'));//微信扫码回调参数
                    $this->assign('wxsaoma',$saomaUrl);
                }
            }
        }else{
            $xml=wxgzhzf('YJ','流年运程',cookie('orderid'));//公众号支付回调参数
            $xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
            $val = json_decode(json_encode($xmlstring),true);
            $noncestr=noncestr(15);//随机字符串
            $timestamp=time();//时间戳

            $stringA="appId=".cookie('APPID')."&nonceStr={$noncestr}&package=prepay_id={$val['prepay_id']}&signType=MD5&timeStamp={$timestamp}";
            $stringSignTemp=$stringA."&key=".cookie('wxKEY');
            $sign=strtoupper(md5($stringSignTemp));

            $this->assign('timeStamp',$timestamp);
            $this->assign('nonceStr',$noncestr);
            $this->assign('package','prepay_id='.$val['prepay_id']);
            $this->assign('signType','MD5');
            $this->assign('paySign',$sign);
            $this->assign('appId',cookie('APPID'));
        }

        $this->assign('csNameJump',U('Lnyc2019/jieguoye','',false).'?ordernum='.cookie('orderid'));//支付成功跳转地址

        $this->assign('channel',cookie('channel'));
        $this->assign('znickname',cookie('znickname'));

        if(changeJieguoPay($channel)){//判断渠道显示结果
            $this->display("Lnyc2019/ZM_2019ys_zhifu_JG");
        }else if(channelVivo($channel)) {
            $this->display("Lnyc2019/ZM_2019ys_zhifu_vivo");
        }else{
            $this->display("Lnyc2019/ZM_2019ys_zhifu");
        }

    }
    public function jieguoye(){
        $channel=cookie('channel');
        $this->assign('titleName',titleName('Lnyc2019',3));//首页名称
        $user_agent = $_SERVER['HTTP_USER_AGENT'];//用户使用的浏览器，操作系统等信息。
        if (strpos($user_agent, 'MicroMessenger') == false) {
            //非微信浏览器访问
            cookie('wxlogin',0);
        }else{
            cookie('wxlogin',1);
            $this->assign('wxlogin',1);

            $noncestr=noncestr(15);
            $timestamp=time();
            $ticket= S('ticket');
            $wzurl=wxJsdkData();
            $signature=sha1("jsapi_ticket={$ticket}&noncestr={$noncestr}&timestamp={$timestamp}&url={$wzurl}");

            $this->assign('appid',cookie('APPID'));
            $this->assign('timestamp',$timestamp);
            $this->assign('noncestr',$noncestr);
            $this->assign('signature',$signature);
        }

        if($_REQUEST['ordernum']){
            $ordernum=$_REQUEST['ordernum'];
            $arrdata[0]=jieguoyeArrData($ordernum);

            $zymd=$arrdata[0]['year'].'-'.str_pad($arrdata[0]['month'],2,"0",STR_PAD_LEFT).'-'.str_pad($arrdata[0]['day'],2,'0',STR_PAD_LEFT);
            cookie('zymd',$zymd,604800);
            cookie('zhour',$arrdata[0]['hour'],604800);
            cookie('znickname',$arrdata[0]['username'],604800);
            cookie('zsex',$arrdata[0]['sex'],604800);
            $hour=$arrdata[0]['hour'];

            $y=mb_substr(cookie('zymd'),0,4);//年
            $m=mb_substr(cookie('zymd'),5,2); //月
            $d=mb_substr(cookie('zymd'),8,2);//日
            $zyinli=yinli($y,$m,$d);
            cookie('zyangli',$y.'年'.$m.'月'.$d.'日'.' '.cookie('zhour').'时',604800);//阳历
            cookie('zyinli',$zyinli[0].'年'.$zyinli[1].$zyinli[2],604800);//阴历

            $zymd= cookie('zymd');
            cookie('orderid',$arrdata[0]['ordernum'],604800);
        }

        //一对一亲算下单
        $QSorder=new \Library\toolOrder();
        $wxzhifuArr=$QSorder->QSorderXD();
        if($wxzhifuArr==1){
            $this->assign('qsPay',1);
        }else{//更新数据hu
            if (strpos($user_agent, 'MicroMessenger') == false) {
                //非微信浏览器访问
            }else{
                $this->assign('timeStamp',$wxzhifuArr['timeStamp']);
                $this->assign('nonceStr',$wxzhifuArr['nonceStr']);
                $this->assign('package',$wxzhifuArr['package']);
                $this->assign('signType',$wxzhifuArr['signType']);
                $this->assign('paySign',$wxzhifuArr['paySign']);
                $this->assign('appId',$wxzhifuArr['appId']);
            }
        }

        if(cookie('zsex')==1){
            $zsex='男';
        }else{
            $zsex='女';
        }
        if($zymd!=''){
            zwmp($zymd,$hour,$zsex,'yc');
            $shengxiao=I('globals.shengxiao');
            $this->assign('shengxiao',$shengxiao);//生肖
            $this->assign('sizhu',I('globals.sizhu'));//Z四柱
            $ssarray=array();
            array_push($ssarray,implode(I('globals.nianzhuss')));
            array_push($ssarray,implode(I('globals.yuezhuss')));
            array_push($ssarray,implode(I('globals.shizhuss')));
            $this->assign('nianzhuss',$ssarray);//十神
            $this->assign('canggan',I('globals.canggan'));//藏干

            $this->assign('zhishen',I('globals.zhishen'));//支神
            $this->assign('sizhuny',I('globals.sizhuny'));//四柱纳音
            $this->assign('bzdishi',I('globals.bzdishi'));//八字地势
            $this->assign('wxsqs',I('globals.wxsqs'));//旺相休囚死
            $this->assign('xiys',I('globals.xiys'));//喜用神
            $this->assign('taiyuan',I('globals.taiyuan'));//胎元
            $this->assign('rikong',I('globals.rikong'));//日空
            $this->assign('dayun',I('globals.dayun'));//大运
            $this->assign('dayunx',I('globals.dayunx'));//大运x
            $this->assign('dayuny',I('globals.dayuny'));//大运y
            $this->assign('dayungz',I('globals.dayungz'));//大运干支
            $this->assign('dayunss',I('globals.dayunss'));//大运十神
            
            $jdxs2019=jdxs2019($zymd,$hour);//精打细算等等
            $this->assign('jdxs2019',$jdxs2019);

            if($channel=='vivo'||$arrdata[0]['channel']=='vivo'||channelVivo($channel)){//2020数据
                $lnyc2020Data=new \Library\Lnyc2020Data();
                $data2020=$lnyc2020Data->index($zymd,$hour);
                $this->assign('data2020',$data2020);
            }else{
                $zhanxing=new \Library\ZhanXing();
                $constellation=$zhanxing->constellation($m,$d);//获取星座

                $lnyuncheng2019=lnyuncheng2019($zymd,I('globals.dayun'),I('globals.dayunss'),$constellation,$hour);
                $this->assign('lnyuncheng2019',$lnyuncheng2019);//2019流年运程
                $this->assign('lnyuncheng',$lnyuncheng2019['lnyuncheng']);//流年运程
                $this->assign('datacolor',$lnyuncheng2019['datacolor']);//数字颜色


                //商品文案
                $shopClerk_all=S('shopClerk_all');
                if(empty($shopClerk_all)){//2019.8.22新修改商品
                    $shopClerk1=M()->query("select name,text from shop_clerk where id=33");
                    $shopClerk_all=$shopClerk1;S('shopClerk_all',$shopClerk_all,600);
                }
                $this->assign('shopClerk_all',$shopClerk_all);

                $fraction=mb_substr($jdxs2019['taohua']['title'],0,2);
                $fraction=$fraction>50?51:50;
                $fraction=$fraction<50?49:50;
                $shopClerk_gqsh1=S('shopClerk_gqsh1'.$fraction);
                if(empty($shopClerk_gqsh1)){
                    $shopClerk1=M()->query("select name,text from shop_clerk where name='gqsh' and shopName='kaiyun1' and  typeName='{$fraction}'");
                    $shopClerk_gqsh1=$shopClerk1[0]['text'];S('shopClerk_gqsh1'.$fraction,$shopClerk_gqsh1,600);
                }
                $this->assign('shopClerk_gqsh1',$shopClerk_gqsh1);

                $shopClerk_cy1=S('shopClerk_cy1');
                if(empty($shopClerk_cy1)){
                    $shopClerk1=M()->query("select name,text from shop_clerk where name='cy' and shopName='kaiyun1'");
                    $shopClerk_cy1=$shopClerk1[0]['text'];S('shopClerk_cy1',$shopClerk_cy1,600);
                }
                $this->assign('shopClerk_cy1',$shopClerk_cy1);

                $shopClerk_sy1=S('shopClerk_sy1');
                if(empty($shopClerk_sy1)){
                    $shopClerk1=M()->query("select name,text from shop_clerk where name='sy' and shopName='kaiyun1'");
                    $shopClerk_sy1=$shopClerk1[0]['text'];S('shopClerk_sy1',$shopClerk_sy1,600);
                }
                $this->assign('shopClerk_sy1',$shopClerk_sy1);

                $shopClerk_jk1=S('shopClerk_jk1');
                if(empty($shopClerk_jk1)){
                    $shopClerk1=M()->query("select name,text from shop_clerk where name='jk' and shopName='kaiyun1'");
                    $shopClerk_jk1=$shopClerk1[0]['text'];S('shopClerk_jk1',$shopClerk_jk1,600);
                }
                $this->assign('shopClerk_jk1',$shopClerk_jk1);

                $shopClerk_xxys1=S('shopClerk_xxys1');
                if(empty($shopClerk_xxys1)){
                    $shopClerk1=M()->query("select name,text from shop_clerk where name='xxys' and shopName='kaiyun1'");
                    $shopClerk_xxys1=$shopClerk1[0]['text'];S('shopClerk_xxys1',$shopClerk_xxys1,600);
                }
                $this->assign('shopClerk_xxys1',$shopClerk_xxys1);
            }



            if(cookie('znickname')!='匿名'){
                $yibiart=yibiArt(cookie('znickname'),901);//一笔艺术签名
                $yibiartx=yibiArt(cookie('znickname'),905);//一笔商务签
                $yibiarty=yibiArt(cookie('znickname'),6);//签名字体
                $this->assign('yibiart',$yibiart);
                $this->assign('yibiartx',$yibiartx);
                $this->assign('yibiarty',$yibiarty);
                if($yibiarty){
                    $this->assign('qianming',1);
                }else{
                    $this->assign('qianming',0);
                }
            }


        }

        $this->assign('channel',cookie('channel'));
        $this->assign('sex',cookie('zsex'));
        if(channelVivo($channel)) {
            $this->display("Lnyc2019/ZM_2019ys_jieguoye_vivo");
        }else{
            $this->display("Lnyc2019/ZM_2019ys_jieguoye");
        }

    }
    public function zzhifu(){
        $data=M()->query("select status from sm_h5test where ordernum='".cookie('orderid')."'");
        $this->assign('status',$data[0]['status']);
        $this->display("Index/ZM_zzhifu");
    }
    public function pay(){//支付宝支付
        $orderid=cookie('orderid');
        $price=cookie('price');
        M()->query("update sm_h5test set price='{$price}' where ordernum='{$orderid}'");
        $this->assign('ordername1','流年运程');
        $this->assign('ordername2','知命-流年运程');
        $this->display("Index/pay");
    }
    public function paywx(){//H5微信支付
        H5ZMwxzhifu('YJ','流年运程',cookie('orderid'),'Lnyc2019');//知命
    }
    public function payGzh(){
        $reducePrice=cookie('reducePrice');
        $discount=cookie('discount');
        if(empty($reducePrice)&&empty($discount)){
            $price=cookie('price')-$_REQUEST['price'];
            cookie('price',$price);
            cookie('reducePrice',1);
        }
        if(cookie('price')<1){
            cookie('price',0.01);
        }

        $xml=wxgzhzf('YJ','流年运程',cookie('orderid'));//公众号支付回调参数
        $xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
        $val = json_decode(json_encode($xmlstring),true);
        $noncestr=noncestr(15);//随机字符串
        $timestamp=time();//时间戳

        $stringA="appId=".cookie('APPID')."&nonceStr={$noncestr}&package=prepay_id={$val['prepay_id']}&signType=MD5&timeStamp={$timestamp}";
        $stringSignTemp=$stringA."&key=".cookie('wxKEY');
        $sign=strtoupper(md5($stringSignTemp));

        $timestamp=(string)$timestamp;
        $Arr=array(
            'timeStamp'=>$timestamp,
            'nonceStr'=>$noncestr,
            'package'=>'prepay_id='.$val['prepay_id'],
            'signType'=>'MD5',
            'paySign'=>$sign,
            'appId'=>cookie('APPID'),
        );
        echo json_encode($Arr);

        //echo '{"timeStamp":1540890782,"nonceStr":"u0pfo3kmavsay81b","package":"prepay_id=","signType":"MD5","paySign":"$sign"}';
    }

}